package com.zjy.heath_ms.controller;

import com.zjy.heath_ms.entity.QueryPageBean;
import com.zjy.heath_ms.entity.Result;
import com.zjy.heath_ms.pojo.vo.SetMealDto;
import com.zjy.heath_ms.service.SetMealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 项目名 heath_ms
 * 类名  SetMealController
 * 作者 lzq
 * 创建时间  2025/5/25 12:21
 */

@RestController
@RequestMapping("/setMeal")
public class SetMealController {

    @Autowired
    private SetMealService setMealService;

    /**
     * 获取套餐信息
     *
     */

    @GetMapping
    public Result getSetMeal(QueryPageBean queryPageBean) {
        return Result.buildSuccess(setMealService.findPage(queryPageBean));
    }

    /**
     * 新增一个套餐
     * @param setMealDto
     * @return
     */
    @PostMapping
    public Result saveSetMeal(SetMealDto setMealDto) {
        return setMealService.saveOne(setMealDto) ? Result.buildSuccess() : Result.buildFail();
    }
}
